import naranja from './naranja'

export default { /*暴露对象*/
  getRepostText(){
    return {
      title: '默认提醒title',
      text: '单击“收到”以查看详情默认text',
      timeout: 'keep',
      buttons: [{
        text: '收到',
        click: function (e) {
          naranja().success({
            title: '通知',
            text: '通知被接受'
          })
        }
      },{
        text: '取消',
        click: function (e) {
          e.closeNotification()
        }
      }],
      reportType:{
        success:false,
        error:false,
        warm:false,
        log:false
      }
    }
  },
  report (report){

    const toReport = {title:report.title,text:report.text,timeout:report.timeout,buttons:report.buttons};
    const {success,error,warn,log} = report.reportType
    let report_type = ''
    if (!success && !error && !warn && !log){
      report_type = 'error';
      toReport.text = '请让report.reportType中有且仅有一个true';
    }
    if (success){
      report_type = 'success';
    }else if (error){
      report_type = 'error'
    }else if (warn){
      report_type = 'warn'
    }else if(log){
      report_type = 'log'
    }


    naranja()[report_type](toReport)
  }
}
